<?php if (!defined('THINK_PATH')) exit();?>﻿<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/Admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/static/h-ui.admin/skin/green/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/static/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="/Public/css/common.css" />
<!--[if IE 6]>
<script type="text/javascript" src="/Public/Admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<title>新建网站角色 - 管理员管理 - H-ui.admin v3.1</title>
</head>
<style>
ul.group-list {
    margin: auto 5px;list-style: disc outside none;
}
ul.group-list li {
    white-space: nowrap;float: left;
    width: 152px; height: 25px;
    padding: 3px 5px;list-style-type: none;
    list-style-position: outside;border: 0px;margin: 0px;
}
th.title {
    background: #F3F3F3;border-bottom: 1px solid #D7D7D7;font-weight: bold; white-space: nowrap;
}
</style>

<body>
<article class="page-container">
	<form onsubmit="return false;" method="post" class="form form-horizontal" id="roleform">
		<input type="hidden" name="role_id" value="<?php echo ($detail['role_id']); ?>" />
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>角色名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="<?php echo ($detail['name']); ?>" placeholder="" id="name" name="data[name]">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2">描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="<?php echo ($detail['remark']); ?>" id="remark" name="data[remark]">
			</div>
		</div>

		<!-- <div class="row cl">
			<label class="form-label col-xs-2 col-sm-2">权限列表：</label>
			<div class="formControls col-sm-9">
				<table class="table table-bordered table-striped dataTable" style="margin-bottom: 10px;">
					<tbody id="row-houtai">
						<?php if(is_array($list)): foreach($list as $kk=>$menu): ?><tr>
								<td class="title left" style="padding-right:50px;">
									<b><?php echo ($menu['name']); ?>：</b>
									<label class="right"><input class="admincheck" type="checkbox" value="1" cka="mod-<?php echo ($menu['id']); ?>">全选</label>
								</td>
							</tr>
							<tr>
								<td>
									<ul class="group-list">
									<?php if(is_array($menu['sub_menu'])): foreach($menu['sub_menu'] as $key=>$vv): ?><li><label><input class="admincheck" type="checkbox" name="right[]" value="<?php echo ($vv['id']); ?>" <?php if($vv['enable'] == 1): ?>checked<?php endif; ?> ck="mod-<<?php echo ($vv['parent_id']); ?>"><?php echo ($vv['name']); ?></label></li><?php endforeach; endif; ?>
									<div class="clear-both"></div>
									</ul>
								</td>
							</tr><?php endforeach; endif; ?>
					</tbody>
					<tfoot>
	                  <tr align="center">
	                    <td>
	                    	<button class="btn btn-default" onclick="resetAdmin()"><i class="Hui-iconfont">&#xe66c;</i>重置</button>
	                    </td>
	                  </tr>
	               </tfoot>
				</table>
			</div>
		</div> -->
		<div class="row cl" style="text-align: center;">
			<button class="btn btn-success radius" style="width: 100px;height: 35px;font-size: 16px;" onclick="roleSubmit()"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/Public/Admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/Public/Admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/Public/Admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/Public/Admin/static/h-ui.admin/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/Public/Admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 

<!-- <script type="text/javascript" src="/Public/Admin/lib/picker/distpicker.data.js"></script> -->
<script type="text/javascript" src="/Public/Admin/lib/picker/distpicker.js"></script>


<script type="text/javascript" src="/Public/js/common.js"></script>
<script type="text/javascript" src="/Public/js/md5.js"></script>

<!--/_footer 作为公共模版分离出去-->

<script type="text/javascript">
	var _index;
	function roleSubmit()
	{
		if($('#name').val() == '' ){
			layer.alert('角色名称不能为空', {icon: 2});
			return false;
		}
		var $form = $("#roleform").serialize();
		// console.log($form);return;
		// action= 
		$.ajax({
			url: "<?php echo U('/admin/admin/roleSave');?>",
			type: 'post',
			data: $form,
			beforeSend: function(){
				_index = layer.load(1);
			},
			success: function(res){
				// console.log(res);
				var data = JSON.parse(res);
				if(data.status == 1){
					layer.msg(data.message,{
						icon:1,time:2000
					},function(){
						parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					})
				}else{
					layer.alert(data.message,{icon:2})
				}
			},
			error: function(){
				layer.alert('网络错误，请稍后重试！', {icon: 2});
				return false;
			},
			complete: function(){
				layer.close(_index);
			}
		});
	}

	$(document).ready(function(){
		$(":checkbox[cka]").click(function(){
			var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
			if($(this).is(':checked')){
				$cks.each(function(){$(this).prop("checked",true);});
			}else{
				$cks.each(function(){$(this).removeAttr('checked');});
			}
		});
	});

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>